<template>
  <div>
    <el-form ref="form" :model="article" label-width="80px">
      <el-form-item label="文章标题">
        <el-input v-model="article.articleName"></el-input>
      </el-form-item>
      <el-form-item label="文章归类">
        <el-select v-model="article.articleSort" placeholder="请选择活动区域">
          <el-option
            v-for="sort in sortList"
            :key="sort.sortName"
            :label="sort.sortName"
            :value="sort.sortId"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="文章标签">
        <el-select v-model="article.articleTag" placeholder="请选择活动区域">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="是否显示">
        <el-switch v-model="article.isShow"></el-switch>
      </el-form-item>
      <el-form-item label="文章描述">
        <el-input v-model="article.articleDescribe" type="textarea"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">修改</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getArticleListToIsShow } from '@/api/sort'

export default {
  name: 'ArticleSubmit',
  // eslint-disable-next-line vue/require-prop-types
  props: {
    article: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      sortList: []
    }
  },
  mounted() {
    this.getArticleSort()
  },
  methods: {
    onSubmit() {
      console.log(this.article)
    },
    getArticleSort() {
      getArticleListToIsShow().then(response => {
        this.sortList = response.data
      })
    }
  }
}
</script>

<style scoped>

</style>
